
#ifndef MQTTPUBLISH_DATA
#define MQTTPUBLISH_DATA

#include <stdint.h>

#define MqttPublish_BufLength 50


//芯片是32位，内存最小变量空间是32位
typedef struct 
{
    uint8_t PubMsg_ID[6];
    uint8_t PubMsg_Firmware:8;
    uint8_t PubMsg_OTA:8;
    uint32_t PubMsg_Squ:32;
    uint32_t PubMsg_Timer_Set[2]; //单位: s
    uint32_t PubMsg_Timer_Rem[2];
    uint16_t PubMsg_Coundown:16; //单位: s(10min)
    uint8_t PubMsg_State:4;
    uint8_t PubMsg_Err:4;
    uint8_t PubMsg_IsHeat:4;
    uint8_t PubMsg_Unit:4;
    uint8_t PubMsg_Reserve:6;
    uint16_t PubMsg_RTD_Set[3];
    int16_t PubMsg_RTD_Temp[3];
    uint16_t CRC16;
}MqttPublish_Msg_S;
typedef union
{
    MqttPublish_Msg_S MqttPublish_Msg;
    uint8_t MqttPublish_Buf[MqttPublish_BufLength];
}MqttPublish_Data_U;

uint8_t* MqttPublish_Encode(MqttPublish_Msg_S data);
MqttPublish_Msg_S MqttPublis_Decode(uint8_t buf[]);
void MqttPublish_Init(void);

#endif
